import axios, { ResponseData } from 'yuxin-base/src/utils/axios'
import { getFollowList as getFollowListFromBase } from 'yuxin-base/src/api/contract-api'



/**
 * 获取预定列表
 * @param data
 */
export const getBookList = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/basesearch/contract/admin/book_list',
		data,
		method: 'POST'
	})
}

/**
 * 获取预定状态
 * @param data
 */
export const getBookStatistics = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/basesearch/contract/admin/book_statistics',
		data,
		method: 'POST'
	})
}

// 获取租客预定详情
export const getBookDetail = (id: string | number): Promise<ResponseData> => {
	return axios.request({
		url: `/admin/contract/book_detail/${id}`,
		method: 'get'
	})
}
// 添加租客预定
export const addContractBook = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/contract/book_add',
		data,
		method: 'POST'
	})
}
// 租客预定提醒付款
export const bookInvitePay = (id: string | number): Promise<ResponseData> => {
	return axios.request({
		url: `/admin/contract/book_invitePay/${id}`,
		method: 'get'
	})
}
// 作废
export const bookObsolete = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/contract/book_obsolete',
		data,
		method: 'POST'
	})
}
// 接受预定
export const bookConfirm = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/contract/book_confirm',
		data,
		method: 'POST'
	})
}
// 取消预定
export const bookCancel = (id: string | number): Promise<ResponseData> => {
	return axios.request({
		url: `/admin/contract/book_cancel/${id}`,
		method: 'POST'
	})
}
// 驳回/拒绝预定
export const bookReject = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/contract/book_reject',
		data,
		method: 'POST'
	})
}
// 获取预定规则详情
export const getHouseBookRule = (): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/house_book_rule/get',
		method: 'get'
	})
}
// 添加预定规则
export const houseBookRuleInsert = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/house_book_rule/insert',
		data,
		method: 'post'
	})
}
// 退定
export const bookBack = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/contract/book_back',
		data,
		method: 'POST'
	})
}
// 转移
export const bookTransfer = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/house_book/transfer',
		data,
		method: 'POST'
	})
}
// 罚没
export const bookConfiscate = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/contract/confiscate',
		data,
		method: 'POST'
	})
}
/**
 * 获取租客合同列表
 * @param data
 */
export const getListRenterContract = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/basesearch/contract/admin/list_renter_contract',
		data,
		method: 'POST'
	})
}

/**
 * 管家端获取租客合同列表
 * @param data
 */
export const getContractPages = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: 'basesearch/contract_doc/contract/pages',
		data,
		method: 'POST'
	})
}

/**
 * 获取租客合同状态 count 新
 * @param data
 */
export const getContractState = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/basesearch/contract_doc/contract_state',
		data,
		method: 'POST'
	})
}

/**
 * 获取企业合同信息
 * @param data
 */
export const getEnterPriseInfo = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/customer/enter_prise/get_enter_prise_info',
		data,
		method: 'POST'
	})
}

/**
 * 获取欠租提醒合同列表
 * @param data
 */
export const getListBackRentRemind = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/basesearch/contract/admin/list_back_rent_remind',
		data,
		method: 'POST'
	})
}

/**
 * 获取租客合同状态  已废弃
 * @param data
 */
export const getCountRenterContract = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/basesearch/contract/admin/count_renter_contract',
		data,
		method: 'POST'
	})
}

// 获取租客合同详情
export const getRenterContractDetail = (id: any): Promise<ResponseData> => {
	return axios.request({
		url: `/admin/renter_contract/get/${id}`,
		method: 'get'
	})
}

// 获取租客合同模板
export const getContractTemplate = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/econtract/dynamic_contract_template/available_list',
		data,
		method: 'POST'
	})
}

/** 获取业主合同周期 */
export const getPeriodTime = (id: string): Promise<ResponseData> => {
	return axios.request({
		url: `/contract/owner_contract/get_period_time/${id}`,
		method: 'GET'
	})
}

// 预览租客合同
export const cal_merge_view = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/renter_contract/cal_merge_view',
		data,
		method: 'POST'
	})
}
// 预览租客合同
export const renterContractPreview = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/renter_contract/cal_view',
		data,
		method: 'POST'
	})
}
// 重新提交合同获取上份合同的结转金额（换房）
export const renterContractCarryForwardPrice = (id: string): Promise<ResponseData> => {
	return axios.request({
		url: `/contract/renter_contract/carry_forward_price/${id}`,
		method: 'GET'
	})
}
// 租客合同新签

export const renterContractInsert = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/renter_contract/insert',
		data,
		method: 'POST'
	})
}
/**
 * 获取业主合同列表
 * @param data
 */
export const getListOwnerContract = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/basesearch/contract/list_owner_contract',
		data,
		method: 'POST'
	})
}

/**
 * 获取业主合同状态
 * @param data
 */
export const getCountOwnerContract = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/basesearch/contract/count_owner_contract',
		data,
		method: 'POST'
	})
}

// 获取业主合同--待签约
export const remindOwnerContract = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/analyser/house/statistics/owner_unsign_count',
		data,
		method: 'post'
	})
}

// 获取业主合同详情
export const getOwnerDetail = (id: string | number): Promise<ResponseData> => {
	return axios.request({
		url: `/admin/owner_contract/get/${id}`,
		method: 'get'
	})
}

// 通过合同id获取物业交割单详情
export const getHouseDeliveryGetNoe = (data: { id: any; type: any }): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/house_delivery/get_one/' + data.id + '?deliveryType=' + data.type,
		method: 'get'
	})
}
// 通过入住人获取物业交割单
export const getOneRenterInfo = (data: { id: any; type: any }): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/house_delivery/get_one_renter_info/' + data.id + '?deliveryType=' + data.type,
		method: 'get'
	})
}
// 预定弹窗搜索房源
export const searchByAddress = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/basesearch/house/search_by_address',
		data,
		method: 'POST'
	})
}

// 计算合同日期之间年月日
export const getContractTime = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/owner_contract/cal_between_date',
		data,
		method: 'POST'
	})
}

/**
 * 获取租约变更列表
 * @param data
 */
export const getRenterApplyList = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/basesearch/contract/admin/renter_apply_list',
		data,
		method: 'POST'
	})
}

/**
 * 获取租约变更状态
 * @param data
 */
export const getRenterApplyStatus = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/basesearch/contract/admin/renter_apply_statistics',
		data,
		method: 'POST'
	})
}

// 签约详情
export const getSignDetail = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/sign/detail',
		data,
		method: 'POST'
	})
}

// 租客合同的拒绝
export const signReject = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/sign/reject',
		data,
		method: 'POST'
	})
}

// 租客合同提醒付款
export const tenantPayment = (id: string | number): Promise<ResponseData> => {
	return axios.request({
		url: `/admin/renter_contract/invite_pay/${id}`,
		method: 'POST'
	})
}
// 邀请签字
export const signature = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/sign/signature',
		method: 'POST',
		data
	})
}

// 租客合同作废
export const tenantContractObsolete = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/renter_contract/obsolete',
		data,
		method: 'POST'
	})
}
// 租客合同签约通过并核对合同
export const tenantContractElectronics = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/sign/sign_link',
		data,
		method: 'POST'
	})
}

// 判断是否可重置合同
export const contractResetValid = (id: string | number, data = {}): Promise<ResponseData> => {
	return axios.request({
		url: `/admin/owner_contract/reset_valid/${id}`,
		data,
		method: 'POST'
	})
}

// 租客重置合同
export const renterContractReset = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/renter_contract/reset',
		data,
		method: 'POST'
	})
}

// 租客合同重新提交
export const renterContractResubmit = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/renter_contract/resubmit',
		data,
		method: 'POST'
	})
}

// 租客合同非正常退租
export const tenantBreakAbNormal = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/renter_contract/break_abnormal',
		data,
		method: 'POST'
	})
}

// 租客合同正常退租
export const tenantBreakNormal = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/renter_contract/break_normal',
		data,
		method: 'POST'
	})
}

/** 租客合同 退租未结算 */
export const breakNotCalc = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/renter_contract/break_not_calc',
		data,
		method: 'POST'
	})
}

// 租客合同非正常退租收支列表
export const cabcelBreakAbnormalList = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/renter_contract/break_abnormal_list',
		data,
		method: 'POST'
	})
}

// 租客合同协议退租
export const break_agreement = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/renter_contract/break_agreement',
		data,
		method: 'POST'
	})
}

/** 租客合同 结算 */
export const break_settle = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/renter_contract/break_settle',
		data,
		method: 'POST'
	})
}

// 租客合同协议退租收支列表
export const break_agreement_list = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/renter_contract/break_agreement_list',
		data,
		method: 'POST'
	})
}

// 租客合同正常退租收支列表
export const tenantBreakNormalList = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/renter_contract/break_normal_list',
		data,
		method: 'POST'
	})
}

// 转租
export const renterContractSublease = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/renter_contract/sublease',
		data,
		method: 'POST'
	})
}

// 换房
export const renterContractChange = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/renter_contract/change',
		data,
		method: 'POST'
	})
}

// 查询租客预定操作记录
export const operationLog = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/system/log_manager/operation_log_pages',
		data,
		method: 'POST'
	})
}
// 获取附件
export const getFileList = (id: string | number): Promise<ResponseData> => {
	return axios.request({
		url: `/oss/upload_file/list_pics_by_biz_id/${id}`,
		method: 'get'
	})
}
// 租约变更，退转换续的拒绝
export const tenantChangeToVoid = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/contract_apply/renter/obsolete_break_apply',
		data,
		method: 'POST'
	})
}

// 获取分阶信息
export const oneSubLevel = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/renter_contract/one_subLevel',
		data,
		method: 'POST'
	})
}

//物业交割单新增
export const houseDeliverySave = (data: any): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/house_delivery/save',
		data,
		method: 'POST'
	})
}

// 物业交割单批量新增
export const houseDeliveryBatchSave = (data: any): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/house_delivery/batch_save',
		data,
		method: 'POST'
	})
}

//物业交割单新增
export const houseDeliveryGetNoe = (data: any): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/house_delivery/get_one/?contractId=' + data.contractId,
		method: 'POST'
	})
}

// 新增同住人
export const roommateSave = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/renter_info/roommate/save',
		data,
		method: 'post'
	})
}
// 删除同住人
export const removeRoommate = (id: string | number): Promise<ResponseData> => {
	return axios.request({
		url: `/contract/renter_info/roommate/remover/${id}`,
		method: 'delete'
	})
}
// 编辑同住人
export const editRoommate = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/renter_info/roommate',
		data,
		method: 'put'
	})
}
// 编辑紧急联系人
export const editEmergency = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/renter_info/emergency',
		data,
		method: 'put'
	})
}
// 删除紧急联系人
export const deleteEmergency = (id: string | number): Promise<ResponseData> => {
	return axios.request({
		url: `/contract/renter_info/emergency/${id}`,
		method: 'delete'
	})
}

//获取房间物品
export const houseConfigGetList = (data: string, type?: number): Promise<ResponseData> => {
	return axios.request({
		url: `/contract/house_delivery/get_detail_by_house_id/${data}${type ? '/' + type : ''}`,
		method: 'GET'
	})
}
// 获取租客实名认证url
export const renterInfoAuthUrl = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/renter_info/auth_url',
		method: 'POST',
		data
	})
}

// 设置欠租提醒
export const setBackRentRemind = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/renter_contract/back_rent_remind',
		method: 'POST',
		data
	})
}

// 设置欠租提醒
export const frozenContract = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/renter_contract/frozen',
		method: 'POST',
		data
	})
}
// 设置欠租提醒
export const getFrozenState = (): Promise<ResponseData> => {
	return axios.request({
		url: '/system/decision/get_by_mark/RENT_ARREARAGE_REMIND_SETTING',
		method: 'GET'
	})
}
// 获取审批进度信息列表
export const getFollowList = getFollowListFromBase
// export const getFollowList = (data: object): Promise<ResponseData> => {
// 	return axios.request({
// 		url: '/workflow/custom/approval/record',
// 		data: data,
// 		method: 'post'
// 	})
// }
// 租客合同导出
export const contractExport = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/basesearch/contract_doc/contract/export',
		data: data,
		method: 'post',
		responseType: 'blob'
	})
}
// 获取合同详情同住人授权
export const renterContractDeviceDetail = (id: string, renterId?: string): Promise<ResponseData> => {
	return axios.request({
		url: `/contract/renter_contract/device/detail/${id}${renterId ? '/' + renterId : ''}`,
		method: 'get'
	})
}
// 获取合同详情入住人授权
export const renterContractEnterDevice = (id: string, empId?: string): Promise<ResponseData> => {
	return axios.request({
		url: `/contract/renter_contract/enter_device/${id}${empId ? '/' + empId : ''}`,
		method: 'get'
	})
}
// 获取门禁门锁是否离线
export const deviceStatus = (id: string): Promise<ResponseData> => {
	return axios.request({
		url: `/contract/renter_contract/device_status/${id}`,
		method: 'get'
	})
}
// 获取水电表读数
export const getCurEleAndWaterQuantity = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/device/device/getCurEleAndWaterQuantity',
		data: data,
		method: 'post'
	})
}

/** 获取设备状态 */
export const getDeviceByIds = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/basesearch/house/house_room/by_ids',
		data: data,
		method: 'post'
	})
}

// 电量清零
export const eleMeterResetByCollector = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/device/device/eleMeterResetByCollector',
		data: data,
		method: 'post'
	})
}
// 水费清零
export const waterMeterChargeReset = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/device/device/waterMeterChargeReset',
		data: data,
		method: 'post'
	})
}
// 新增和更新接口
export const batchDeviceSave = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/renter_device_info/save/batch/device',
		data,
		method: 'post'
	})
}
// 获取租约变更详情
export const renterContractApplyDetail = (id: string): Promise<ResponseData> => {
	return axios.request({
		url: `/admin/contract_apply/renter/detail_apply/${id}`,
		method: 'get'
	})
}

/**
 * 审批撤销
 * @param data
 */
export const approvalRevoke = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/workflow/custom/approval/revoke',
		data,
		method: 'POST'
	})
}

/**
 * 审批通过/驳回
 * @param data
 */
export const setApproval = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/workflow/custom/approval/approval',
		data,
		method: 'POST'
	})
}

/**
 * 根据合同ID获取设备预警
 * @param data
 */
export const deviceEnergyWarningById = (data: string): Promise<ResponseData> => {
	return axios.request({
		url: `/device/deviceEnergyWarning/list_by_contract/${data}`,
		method: 'GET'
	})
}
/**
 * 根据房源ID获取设备预警详情
 * @param data
 * @param methods 生成账单方式【1：不生成，2：预付费，3：后付费】
 */
export const queryRoomPlan = (data: string, methods?: number): Promise<ResponseData> => {
	return axios.request({
		// url: `/system/energyCostPlan/query_room_plan/${data}`,
		url: `/device/energy_cost_room_setting/detail/${methods}/${data}`,
		method: 'GET'
	})
}
/**
 * 根据房源ID获取设备预警24小时详情
 * @param data
 */
export const meterReadRecordLastRecord = (data: any): Promise<ResponseData> => {
	return axios.request({
		url: '/device/meter_read_record/last_record',
		data,
		method: 'POST'
	})
}

/**
 * 企业库列表不分页
 * @param data
 */
export const getEnterPriseLibraryListAll = (data: any): Promise<ResponseData> => {
	return axios.request({
		url: '/customer/enter_prise/get_enter_prise_library_all',
		data,
		method: 'POST'
	})
}

/**
 * 获取所有空置房间
 * @param data
 */
export const getVacancyHouseList = (data: any): Promise<ResponseData> => {
	return axios.request({
		url: '/basesearch/house/enterprise_contract/vacancy',
		data,
		method: 'POST'
	})
}

/**
 * 包租合同新签
 * @param data
 */
export const insertEnterContract = (data: any): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/enter_contract/insert_enter_contract',
		data,
		method: 'POST'
	})
}
/**
 * 查询电子合同
 * @param data
 */
export const signPreviewUrl = (data: any): Promise<ResponseData> => {
	return axios.request({
		url: '/econtract/contract/sign_preview_url',
		data,
		method: 'POST'
	})
}
/**
 * 查询电子合同
 * @param data
 */
export const signFileDownloadUrl = (data: any): Promise<ResponseData> => {
	return axios.request({
		url: `/econtract/contract/sign_file_download_url/${data}`,
		method: 'GET'
	})
}

/**
 * 导出能源费模版
 * @param data
 */
export const exportFinanceRecorrd = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/finance_verify_record/enterprise/export',
		data,
		method: 'POST',
		responseType: 'blob'
	})
}

/**
 * 合约账单下拉列表
 * @param data
 */
export const getContractList = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/customer/enter_prise/get_enter_prise_library_list',
		data,
		method: 'POST'
	})
}

/**
 * 合约账单列表
 * @param data
 */
export const getEnterpriseList = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/basesearch/finance_bill/enterprise/list',
		data,
		method: 'POST'
	})
}

export const financeImport = 'finance/finance_verify_record/enterprise/import'

/**
 * 确认核销
 * @param data
 */
export const confirmCheck = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/finance_verify/confirm',
		data,
		method: 'POST'
	})
}

/**
 * 通过员工查员工入住详情
 * @param data
 */
export const employeeCheckinDetails = (data: any): Promise<ResponseData> => {
	return axios.request({
		url: `/customer/enter_prise_employee/get_employee_checkin_details/${data}`,
		method: 'POST'
	})
}

/**
 * 搬离
 * @param data
 */
export const charterCheckOutHouse = (data: any): Promise<ResponseData> => {
	return axios.request({
		url: '/customer/enter_prise_employee/charter_check_out_house',
		method: 'POST',
		data
	})
}
/**
 * 查询已签约企业
 * @param data
 */
export const enterPriseLibraryQuery = (data: any): Promise<ResponseData> => {
	return axios.request({
		url: '/customer/enter_prise/get_enter_prise_library_query',
		method: 'POST',
		data
	})
}

/**
 * 包租合同 批量退租
 * @param data
 */
export const batchQuitEnterContract = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/enter_contract/batch_quit_enter_contract',
		data,
		method: 'POST'
	})
}

/**
 * 企业合同 批量退租 结算退租
 * @param data
 */
export const batchQuitSettle = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/enter_contract/batch_quit_settle',
		data,
		method: 'POST'
	})
}

/**
 * 根据房源ID查设备类型，付费模式
 * @param data
 */
export const houseSetting = (data: string): Promise<ResponseData> => {
	return axios.request({
		url: `/device/meter_read_record/contract/${data}`,
		method: 'POST'
	})
}

/**
 * 包租合同补签协议
 * @param data
 *
 */
export const supplementaryAgreementF = (data: string): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/enter_contract/mend_enter_contract_houseroom',
		data,
		method: 'POST'
	})
}

/**
 * 包租合同续签
 * @param data
 */
export const renewalF = (data: string): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/enter_contract/renew_enter_contract',
		data,
		method: 'POST'
	})
}

/**
 * 包租合同or企业合同 换房
 * @param data
 *
 */
export const change = (data: string): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/enter_contract/change',
		data,
		method: 'POST'
	})
}

/**
 * 包租合同or企业合同 换房重新提交
 * @param data
 *
 */
export const childerResubmit = (data: string): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/enter_contract/childer_resubmit',
		data,
		method: 'POST'
	})
}

/**
 * 获取手续费
 * @param data
 */
export function getCommission(data: object): Promise<ResponseData> {
	return axios.request({
		url: '/admin/renter_contract/get_commission',
		data,
		method: 'POST'
	})
}
/**
 * 添加补充合同
 * @param data
 */
export const signatureSupplement = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/contract_supplement/save',
		data,
		method: 'POST'
	})
}

/**
 * 补充合同邀请签字
 * @param data
 */
export const inviteSign = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/sign/signature_supplement',
		data,
		method: 'POST'
	})
}

/**
 * 补充合同PDF预览地址
 * @param data
 */
export const getSupplementPreview = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/econtract/contract/sign_supplement_preview_url',
		data,
		method: 'POST'
	})
}
/**
 * 补充合同PDF下载地址
 * @param data
 */
export const supplement_sign_file_stream = (supplementId: object): Promise<ResponseData> => {
	return axios.request({
		url: `/econtract/contract/supplement_sign_file_stream/${supplementId}/2`,
		responseType: 'arraybuffer',
		method: 'GET'
	})
}

/**
 * 补充合同PDF预览地址
 * @param data
 */
export const register_renter = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/econtract/bestsign_renter_sign/register_renter',
		data,
		method: 'POST'
	})
}

/**
 * 补充合同PDF下载地址
 * @param data
 */
export const sign_file_stream = (contractId: object): Promise<ResponseData> => {
	return axios.request({
		url: `/econtract/contract/sign_file_stream/${contractId}/2`,
		responseType: 'arraybuffer',
		method: 'GET'
	})
}
/**
 * 下载补充合同
 * @param data
 */
export const downloadSupplement = (supplementId: string): Promise<ResponseData> => {
	return axios.request({
		url: `/econtract/contract/sign_file_download_supplement_url/${supplementId}`,
		method: 'GET'
	})
}

/**
 * 获取签署地址
 * @param data
 */
export const getSupplementExecuteUrl = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/econtract/econtract/esign/sign_supplement_execute_url',
		data,
		method: 'POST'
	})
}

/**
 * 获取流程具体审批流程
 * @param data
 */
export const getConcreteRecord = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/workflow/custom/approval/concrete_record',
		data,
		method: 'POST'
	})
}

/**
 * 合并添加补充合同 + 邀请签字的接口
 * @param data
 */
export const combineSignatureSupplement = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: 'admin/sign/signature_supplement',
		data,
		method: 'POST'
	})
}
/**
 * 修改包租合同支付配置归属方
 * @param data
 */
export const modifyConfiguration = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/enter_contract/update_contract_pay_config',
		data,
		method: 'POST'
	})
}

//审批重新提交
export const resubmitF = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/enter_contract/resubmit',
		data,
		method: 'POST'
	})
}
/**
 * 修改包租合同支付配置归属方
 * @param data
 */
export const enterBreakList = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: 'admin/renter_contract/enter_break_list',
		data,
		method: 'POST'
	})
}

/**
 *租客合同-未签字合同预览地址
 */
export const downPreview = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/renter_contract/view_unsigned_pdf_url',
		data,
		method: 'post'
	})
}
/**
 * 租客合同-签约完成
 */
export const tenantSigning = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/renter_contract/sign_complete',
		data,
		method: 'POST'
	})
}

/**
 * 获取合同模板列表
 */
export const getContractTemplateData = (data): Promise<ResponseData> => {
	return axios.request({
		url: '/econtract/dynamic_contract_template/available_list',
		data,
		method: 'POST'
	})
}

/**
 * 修改手机号-判断该手机号是否有业务关联
 */
export const verifyPhone = (phone: string,id:string): Promise<ResponseData> => {
	return axios.request({
		url: `/contract/renter_info_record/verify_phone/${id}/${phone}`,
		method: 'GET'
	})
}

/**
 * 修改手机号-租客合同手机号变更记录列表
 */
export const renterInfoRecordList = (id: string): Promise<ResponseData> => {
	return axios.request({
		url: `/contract/renter_info_record/get_renter_info_record_list/${id}`,
		method: 'GET'
	})
}

/**
 * 修改手机号-修改手机号
 */
export const updateRenterPhone = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/renter_info_record/add_renter_info_record',
		method: 'POST',
		data
	})
}

// 修改包租合同联系人
export const updateEnterprise = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/enter_contract/update_enterprise_user_id',
		method: 'POST',
		data
	})
}
// 续签完包租合同增加入住员工的门禁门锁时间
export const extendAuthorization = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/renter_contract/add_empower',
		method: 'POST',
		data
	})
}

// 业主合同新签
export const ownerContractInsert = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/owner_contract/insert',
		method: 'POST',
		data
	})
}
// 业主合同重置
export const ownerContractReset = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/owner_contract/reset',
		method: 'POST',
		data
	})
}

//业主合同账单预览

export const ownerContractCalculate = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/owner_contract/calculate',
		method: 'POST',
		data
	})
}
// 获取业主合同详情
export const getOwnerContractDetail = (id: any): Promise<ResponseData> => {
	return axios.request({
		url: `/admin/owner_contract/get/${id}`,
		method: 'get'
	})
}
// 业主合同作废
export const ownerContractObsolete = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/owner_contract/obsolete',
		method: 'POST',
		data
	})
}

// 业主合同非正常退租收支列表
export const ownerBreakAbnormalList = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/owner_contract/break_abnormal_list',
		data,
		method: 'POST'
	})
}

// 业主合同正常退租收支列表
export const ownerBreakNormalList = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/owner_contract/break_normal_list',
		data,
		method: 'POST'
	})
}

// 业主合同正常退租
export const ownerBreakNormal = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/owner_contract/break_normal',
		data,
		method: 'POST'
	})
}

// 业主合同非正常退租
export const ownerBreakAbnormal = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/owner_contract/break_abnormal',
		data,
		method: 'POST'
	})
}

// 业主合同导出
export const ownerContractExport = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/basesearch/contract/export',
		data,
		method: 'POST',
		responseType: 'blob'
	})
}
// 业主合同充值前判断
export const ownerContractResetValid = (data: string): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/owner_contract/reset_valid/' + data,
		method: 'POST'
	})
}

//获取企业合同子合同房间数量
export const contractCount = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/enter_contract/renter_contract_count',
		data,
		method: 'POST'
	})
}

//获取房间租客合同周期
export const getRenterPeriodTime = (data: string): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/owner_contract/get_renter_period_time/' + data,
		method: 'get'
	})
}
//获取房间租客合同周期
export const ownerContractSubLevel = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/owner_contract/subLevel',
		method: 'POST',
		data
	})
}

/** 获取开票金额 */
export const getInvoicingPrice = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/invoicing/price',
		method: 'POST',
		data
	})
}

/** 根据房源id或项目id 查询是否存在有效业主合同 */
export const ownerContractCheckValid = (communityId: string, houseId?: string): Promise<ResponseData> => {
	return axios.request({
		url: `/contract/owner_contract/check_valid/${communityId}${houseId ? '/' + houseId : ''}`,
		method: 'get'
	})
}

/** 根据房源id获取有效业主合同的签约时间段 */
export const getPeriodTimes = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/owner_contract/get_period_times',
		method: 'POST',
		data
	})
}

//获取房间租客合同周期
export const getImportContractList = (data?: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/renter_contract/getImportContractList',
		method: 'POST',
		data
	})
}

/** 获取活动优惠 */
export const discounts = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/renter_contract/discounts',
		method: 'POST',
		data
	})
}
/** 业主合同重新提交*/
export const ownerContractResubmit = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/owner_contract/resubmit',
		method: 'POST',
		data
	})
}

//获取房间租客合同周期
export const checkImportContractBill = (data?: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/renter_contract/checkImportContractBill',
		method: 'POST',
		data
	})
}

//批量导入合同
export const importBatchContractList = (data?: object): Promise<ResponseData> => {
	return axios.request({
		url: '/admin/renter_contract/importBatchContractList',
		method: 'POST',
		data
	})
}

//保存导出合同
export const saveTmpImportContract = (data?: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/renter_contract/saveTmpImportContract',
		method: 'POST',
		data
	})
}

//确认导出合同
export const confirmImportContract = (data?: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/renter_contract/confirmImportContract',
		method: 'POST',
		data
	})
}

//去除导出合同
export const removeImportContract = (data?: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/renter_contract/removeImportContract',
		method: 'POST',
		data
	})
}

//获取导出合同
export const exportContractHouseTemplate = (data?: object): Promise<ResponseData> => {
	return axios.request({
		url: '/basesearch/house/exportContractHouseTemplate',
		method: 'POST',
		data,
		responseType: 'arraybuffer'
	})
}

//获取导出合同历史
export const getHistoryImportContract = (data?: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/renter_contract/getHistoryImportContract',
		method: 'POST',
		data
	})
}

//获取导入失败合同
export const exportErrorContract = (data?: object): Promise<ResponseData> => {
	return axios.request({
		url: '/contract/renter_contract/exportErrorContract',
		method: 'POST',
		responseType: 'arraybuffer',
		data
	})
}

// 获取门禁设备状态
export const accessControlStatus = (data?: object): Promise<ResponseData> => {
	return axios.request({
		url: '/device/access/control/count_status',
		method: 'POST',
		data
	})
}
